<template>
  <van-switch v-bind="$attrs" v-model="checked" :size="size" />
</template>

<script setup lang="ts">
import { computed } from 'vue'

export interface SwitchProps {
  modelValue?: any
  size?: string | number
}

const props = withDefaults(defineProps<SwitchProps>(), {
  size: 26
})
const emits = defineEmits({
  'update:modelValue': (val) => !!val
})

const checked = computed({
  get: () => {
    return props.modelValue
  },
  set: (val) => {
    emits('update:modelValue', val)
  }
})

defineOptions({
  name: 'VSwitch '
})
</script>

<style scoped></style>
